#include "CP_Dialogs.h"
#include <stdio.h>
#include <stdlib.h>

// TODO: Move char* return value into arg list.  Return error code.  Add options struct to arg list.
int main(int argc, char* argv[])
{
    printf("Console Demo\n\n");
    
    {
        enum {size = 255};
        char file[size];
        
        OpenFileOptions options = make_open_options();
        options.choose_directories = 1;
        options.title = "Open a Single File";
        printf("%s\n", options.title);
        
        if(open_file_dialog(file, size, &options) > 0)
            printf("Open file: %s\n", file);
        
        {
            int i;
            enum {e_count = 5};
            enum {size = 255};
            char* files[e_count];
            int count = e_count;
            
            for(i = 0; i < count; i++)
                files[i] = (char*)malloc(size);
            
            printf("Open Multiple Files\n");
            
            count = open_files_dialog((char**)files, count, size, NULL);
            
            for(i = 0; i < count; i++)
                printf("Open files: %s\n", files[i]);
            
            for(i = 0; i < count; i++)
                free(files[i]);
        }
        
        
        {
            SaveFileOptions options = make_save_options();
            options.title = "Pick a Save Location";
            printf("%s\n", options.title);
            
            if(save_file_dialog(file, size, &options) > 0)
                printf("Save file: %s\n", file);
        }
    }
    
    {
        int r, g, b, a;
        ColorPickerOptions options = make_color_picker_options();
        options.use_alpha = 1;
        r = g = b = 0;
        a = 255;
        
        if(color_picker_dialog(&r, &g, &b, &a, &options) > 0)
            printf("Color: %d, %d, %d, %d\n", r, g, b, a);
    }
	
	return 0;
}


